package fina2.dcs.load;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

@SuppressWarnings("serial")
public class ResourceLoaderServlet extends HttpServlet {
	private Logger log = Logger.getLogger(getClass());

	public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
		log.info("Loading Logo");
		InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("fina_icon.png");
		OutputStream os = res.getOutputStream();
		byte[] b = new byte[is.available()];
		res.setContentLength(b.length);
		is.read(b);
		os.write(b);
		os.close();
		log.info("Logo Loaded");
	}
}
